Skip to content

fix(determinism): asteroid roll keys on the saved world seed; stable audio hashes - #722

Merged
marceld23 merged 1 commit into
mainfrom
fix/seed-determinism
Aug 4, 2026
Merged

fix(determinism): asteroid roll keys on the saved world seed; stable audio hashes#722
marceld23 merged 1 commit into
mainfrom
fix/seed-determinism

Conversation

@marceld23

Copy link
Copy Markdown
Owner

Summary

Two seed-determinism fixes surfaced by a worldgen audit:

  • Asteroid family/size roll now keys on the saved world seed. SpawnAsteroid mixed _config.Seed (the launch flag, 0 in desktop singleplayer) instead of the persisted _meta.Seed. Desktop worlds therefore all shared the same per-field rock family patterns, and relaunching a hosted world with a different/absent --seed silently re-rolled every asteroid — contradicting the Varied mini-asteroids in space: seeded sizes and mineral families, including water ice #687 guarantee that the same world always grows the same rocks. Ordinal 0 stays pinned to the classic metallic rock.
  • ProceduralAudio uses a stable string hash. 10 noise generators seeded System.Random with name.GetHashCode(), which is per-process randomized on .NET Core and differs across runtimes/backends. Replaced with the codebase-standard order-dependent stable hash (same convention as NpcView/FloraTints).

closes #719
closes #720

Test plan

  • Extended SpaceAsteroids_RollSeededFamiliesAndSizes: reloading the same save under a different launch-config seed must yield identical rocks (fails on the old code).
  • Full non-Slow suite locally in Release: 1398 server + 147 client passing, 0 failures.
  • Clean Release build with 0 warnings; local Unity client build succeeded (client file changed; PR CI does not build Unity).

🤖 Generated with Claude Code

…audio hashes (#719, #720)

- #719: SpawnAsteroid's family/size roll mixed _config.Seed (launch flag, 0 in
  desktop singleplayer) instead of the persisted _meta.Seed - desktop worlds all
  shared the same per-field rock patterns, and relaunching a hosted world with a
  different/absent --seed silently re-rolled every asteroid. Regression test:
  reloading the same save under a different launch-config seed keeps the rocks.
- #720: ProceduralAudio seeded its noise synthesis from name.GetHashCode() at 10
  sites; string hashes are per-process randomised on .NET Core and differ across
  runtimes. Replaced with the codebase-standard stable order-dependent hash.

Co-Authored-By: Claude Fable 5 <[email protected]>
@marceld23
marceld23 force-pushed the fix/seed-determinism branch from f0ae22b to cf4e501 Compare August 4, 2026 16:57
@marceld23
marceld23 merged commit b769cd3 into main Aug 4, 2026
16 checks passed
@marceld23
marceld23 deleted the fix/seed-determinism branch August 4, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant